package com.century.sjt.activity.Pay;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.century.sjt.R;
import com.century.sjt.activity.BaseActivity;
import com.century.sjt.entity.Merchant;
import com.century.sjt.util.Constant;
import com.century.sjt.EMChat.widget.EaseTitleBar;

import java.util.ArrayList;
import java.util.List;

/**
 * 商家资质
 */
public class MerchantDataActivity extends BaseActivity {
    private EaseTitleBar titleBar;
    private Merchant aMerchant;
    private ImageView img_1,img_2,img_3,img_4,img_5,img_6;
    private List<ImageView> LisetImageView=new ArrayList<>();
    private String imgURL;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sjt_merchantdata_activity);
        Intent intent = getIntent();
        aMerchant=(Merchant)intent.getSerializableExtra("Merchant");
        imgURL=aMerchant.getImage();
//        Log.e("img",imgURL);
        initView();
        initEvent();
        initData();


    }

    @Override
    protected void initView() {
        titleBar = (EaseTitleBar) findViewById(R.id.title_bar);
        titleBar.setTitle(aMerchant.getShopName());
        titleBar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        img_1=(ImageView)findViewById(R.id.shopdata_img1);
        img_2=(ImageView)findViewById(R.id.shopdata_img2);
        img_3=(ImageView)findViewById(R.id.shopdata_img3);
        img_4=(ImageView)findViewById(R.id.shopdata_img4);
        img_5=(ImageView)findViewById(R.id.shopdata_img5);
        img_6=(ImageView)findViewById(R.id.shopdata_img6);
        img_1.setVisibility(View.GONE);
        img_2.setVisibility(View.GONE);
        img_3.setVisibility(View.GONE);
        img_4.setVisibility(View.GONE);
        img_5.setVisibility(View.GONE);
        img_6.setVisibility(View.GONE);
        LisetImageView.add(img_1);
        LisetImageView.add(img_2);
        LisetImageView.add(img_3);
        LisetImageView.add(img_4);
        LisetImageView.add(img_5);
        LisetImageView.add(img_6);
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData() {
        String [] newsplitstr = imgURL.split("\\|");
        for (int i=0;i<newsplitstr.length;i++){
            String aimgUrl = Constant.BaseWebHost + newsplitstr[i];
            Log.e("img",aimgUrl);
            ImageView ShowView=LisetImageView.get(i);
            ShowView.setVisibility(View.VISIBLE);
            Glide.with(this).load(aimgUrl).into(ShowView);
        }
//        String aimgUrl = Constant.BaseWebHost + newsplitstr[0];
//        Log.e("img",aimgUrl);
//        ImageView ShowView=LisetImageView.get(0);
//        ShowView.setVisibility(View.VISIBLE);
//        Glide.with(this).load(aimgUrl).into(ShowView);

    }
}
